package Menu;

import java.awt.*;
import java.io.File;
import java.io.IOException;

import javax.imageio.ImageIO;
import javax.swing.Box;
import javax.swing.BoxLayout;
import javax.swing.JPanel;
import principal.Fenetre;

public class Menu extends JPanel
{
	private Image img;
	
	private BoutonSolo solo;
	private BoutonMulti multi;
	private BoutonHelp help;
	private BoutonQuit quit;
	
	public Menu()
	{
		this.setSize(Fenetre.getLargeur(),Fenetre.getHauteur());
		setPreferredSize(new Dimension(Fenetre.getLargeur(),Fenetre.getHauteur()));
		setMinimumSize(new Dimension(Fenetre.getLargeur(),Fenetre.getHauteur()));
		setMaximumSize(new Dimension(Fenetre.getLargeur(),Fenetre.getHauteur()));
		
		this.setLayout(new BoxLayout(this, BoxLayout.PAGE_AXIS));
		this.setLocation(0,0);
		
		try {img = ImageIO.read(new File("images/fond.png"));} catch (IOException e) {e.printStackTrace();}
		
		
		solo = new BoutonSolo();
		multi = new BoutonMulti();
		help = new BoutonHelp();
		quit = new BoutonQuit();
		
		this.add(Box.createRigidArea(new Dimension(50,300)));
		this.add(solo);
		this.add(Box.createRigidArea(new Dimension(0,50)));
		this.add(multi);
		this.add(Box.createRigidArea(new Dimension(0,50)));
		this.add(help);
		this.add(Box.createRigidArea(new Dimension(0,50)));
		this.add(quit);
	}
	
	public void paintComponent(Graphics g)
	{
		 Graphics2D g2d = (Graphics2D)g;
	     g2d.drawImage(img, 0, 0, this.getWidth(), this.getHeight(), this);
	}
}
